package app_config

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	MysqlConfig
	EsConfig
}
type MysqlConfig struct {
	Host string
	Port string
	User string
	Pwd  string
}
type EsConfig struct {
	Host string
	Port int
}

var AppConf AppConfig

func Init() {
	viper.SetConfigFile("./app_config/app.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	viper.Unmarshal(&AppConf)
	fmt.Println("viper 配置成功:", AppConf)
}
